package com.zrrd.gmall.webll.controller;

import com.alibaba.fastjson.JSONObject;
import com.zrrd.gmall.common.result.Result;
import com.zrrd.gmall.product.fegin.ProductFeginClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Controller
public class IndexController {
    @Autowired
    private ProductFeginClient productFeginClient;

    @GetMapping({"/", "index.html"})
    public String index(HttpServletRequest request) {
        // 获取首页分类数据
        Result result = productFeginClient.getBaseCategoryList();
        request.setAttribute("list", result.getData());
        return "index/index";
    }


}
